using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using wpffc.contracts.viewmodels.commands;

namespace wpffc.contracts.viewmodels.learning
{
    public class LearningViewModel : INotifyPropertyChanged
    {
        public LearningViewModel()
        {
            this.ShowAnswerCmd = new RelayCommand(p => { 
                                                           AnswerVisibility = Visibility.Visible;
                                                           this.ScoreKnowledgeCmd.In_IsEnabled(true);
                                                       });
            this.ScoreKnowledgeCmd = new FlowCommand<bool>(p => bool.Parse(p.ToString()));
            this.ScoreKnowledgeCmd.In_IsEnabled(false);
        }


        public ICommand ShowAnswerCmd { get; set; }
        public FlowCommand<bool> ScoreKnowledgeCmd { get; set; }


        private string _question;
        public string Question
        {
            get { return _question; }
            set { _question = value; this.PropertyChanged(this, new PropertyChangedEventArgs("Question")); }
        }

        private string _answer;
        public string Answer
        {
            get { return _answer; }
            set { _answer = value; this.PropertyChanged(this, new PropertyChangedEventArgs("Answer")); }
        }

        private Visibility _answerVisibility = Visibility.Hidden;
        public Visibility AnswerVisibility
        {
            get { return _answerVisibility; }
            set { _answerVisibility = value; this.PropertyChanged(this, new PropertyChangedEventArgs("AnswerVisibility")); }
        }


        public event PropertyChangedEventHandler PropertyChanged = delegate { };
    }
}